{% extends 'base_for_react.html' %}
{% load seahub_tags %}

{% block sub_title %}{{filename}} - {% endblock %}

{% block extra_script %}
<script type="text/javascript">
// overwrite the one in base_for_react.html
window.app.pageOptions = {
  server: '{{ service_url }}',
  username: '{{ user.username|escapejs }}',
  userNickName: '{{request.user.username|email2nickname|escapejs}}',

  canGenerateShareLink: {% if user.permissions.can_generate_share_link %} true {% else %} false {% endif %},
  canSendShareLinkEmail: {% if user.permissions.can_send_share_link_mail %} true {% else %} false {% endif %},
  shareLinkPasswordMinLength: {{ share_link_password_min_length }},
  shareLinkExpireDaysDefault: {{ share_link_expire_days_default }},
  shareLinkExpireDaysMin: {{ share_link_expire_days_min }},
  shareLinkExpireDaysMax: {{ share_link_expire_days_max }},

  // for all types of files
  fileName: '{{ filename|escapejs }}',
  isStarred: {% if is_starred %}true{% else %}false{% endif %},
  isLocked: {% if file_locked %}true{% else %}false{% endif %},
  latestContributor: '{{ latest_contributor|escapejs }}',
  latestContributorName: '{{ latest_contributor|email2nickname|escapejs }}',
  lastModificationTime: '{{ last_modified }}',
  repoID: '{{ repo.id }}',
  repoName: '{{ repo.name|escapejs }}',
  repoEncrypted: {% if repo.encrypted %}true{% else %}false{% endif %},
  filePath: '{{ path|escapejs }}',
  filePerm: '{{ file_perm }}',
  fileType: '{{ filetype }}',
  parentDir: '{{ parent_dir|escapejs }}',
  err: '{{ err }}',
  seafileCollabServer: '{{seafile_collab_server}}',
  contactEmail: "{{request.user.username|email2contact_email|escapejs}}",
  lockedByMe: {% if locked_by_me %}true{% else %}false{% endif %},
  canLockUnlockFile: {% if can_lock_unlock_file %}true{% else %}false{% endif %},
  canEditFile: {% if can_edit_file %}true{% else %}false{% endif %}, // only for some file types 
  canDownloadFile: {% if can_download_file %}true{% else %}false{% endif %},
  enableComment: {% if enable_file_comment %}true{% else %}false{% endif %},
  enableWatermark: {% if enable_watermark %}true{% else %}false{% endif %},
  
  // for {{filetype}} file
  {% block extra_data %}
  {% endblock %}
};
window.app.userInfo = {
  username: '{{ user.username }}',
  name: '{{ user.username|email2nickname|escapejs }}',
  contact_email: '{{ user.username|email2contact_email }}',
}
</script>
{% block render_bundle %}{% endblock %}
{% endblock %}
